package main

import (
	"log"
	"time"

	"github.com/djhworld/simple-computer/io"
	"github.com/go-gl/gl/v3.2-compatibility/gl"
	"github.com/go-gl/glfw/v3.2/glfw"
)

// GlfwIO is for running the system using GLFW.
// libglfw3 will be required on the system
type GlfwIO struct {
	glfwDisplay     *glfwDisplay
	screenChannel   chan *[160][240]byte
	keyPressChannel chan *io.KeyPress
	quitChannel     chan bool
}

func NewGlfwIO(screenChannel chan *[160][240]byte, keyPressChannel chan *io.KeyPress, quitChannel chan bool) *GlfwIO {
	log.Println("Creating GLFW based IO Handler")
	glfwDisplay := newGlfwDisplay(func() {
		close(quitChannel)
	})

	return &GlfwIO{
		glfwDisplay,
		screenChannel,
		keyPressChannel,
		quitChannel,
	}
}

func (i *GlfwIO) Run() {
	clock := time.Tick(33 * time.Millisecond)
	for {
		<-clock
		select {
		case <-i.quitChannel:
			i.glfwDisplay.Destroy()
			return
		case frame := <-i.screenChannel:
			i.glfwDisplay.DrawFrame(frame)
		}
	}
}

func (i *GlfwIO) Init(title string) error {
	var err error

	err = i.glfwDisplay.init(title)
	if err != nil {
		return err
	}

	i.glfwDisplay.window.SetKeyCallback(func(w *glfw.Window, key glfw.Key, scancode int, action glfw.Action, mods glfw.ModifierKey) {
		if action == glfw.Repeat {
			i.keyPressChannel <- &down_key_presses[int(key)]
			return
		}

		if action == glfw.Press {
			i.keyPressChannel <- &down_key_presses[int(key)]
		} else {
			i.keyPressChannel <- &up_key_presses[int(key)]
		}
	})

	return err
}

func newGlfwDisplay(onCloseHandler func()) *glfwDisplay {
	d := new(glfwDisplay)
	d.onCloseHandler = onCloseHandler
	return d
}

type glfwDisplay struct {
	Name           string
	onCloseHandler func()
	window         *glfw.Window
}

func (s *glfwDisplay) init(title string) error {
	var err error

	if err := glfw.Init(); err != nil {
		log.Fatalln("failed to initialize glfw:", err)
	}

	glfw.WindowHint(glfw.Resizable, glfw.False)
	window, err := glfw.CreateWindow(240, 160, "Testing", nil, nil)
	if err != nil {
		return err
	}

	window.SetTitle(title)

	vidMode := glfw.GetPrimaryMonitor().GetVideoMode()

	window.SetPos(vidMode.Width/3, vidMode.Height/3)

	window.MakeContextCurrent()

	if err := gl.Init(); err != nil {
		return err
	}

	gl.ClearColor(0.255, 0.255, 0.255, 0)

	window.SetCloseCallback(func(w *glfw.Window) {
		s.onCloseHandler()
	})

	s.window = window

	return nil

}

func (s *glfwDisplay) Destroy() {
	log.Println("Destroying window")
	s.window.Destroy()
	log.Println("Destroying GLFW instance")
	glfw.Terminate()
}

func (s *glfwDisplay) DrawFrame(screenData *[160][240]byte) {
	fw, fh := s.window.GetFramebufferSize()
	gl.Viewport(0, 0, int32(fw), int32(fh))
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	gl.Ortho(0, float64(240), float64(160), 0, -1, 1)
	gl.ClearColor(0.255, 0.255, 0.255, 0)
	gl.Clear(gl.COLOR_BUFFER_BIT)
	gl.MatrixMode(gl.MODELVIEW)
	gl.LoadIdentity()

	gl.Clear(gl.COLOR_BUFFER_BIT)
	gl.Disable(gl.DEPTH_TEST)
	gl.PointSize(2.0)
	gl.Begin(gl.POINTS)
	for y := 0; y < 160; y++ {
		for x := 0; x < 240; x++ {
			var pixel byte = screenData[y][x]
			if pixel > 0 {
				gl.Color3ub(220, 220, 220)
				gl.Vertex2i(int32(x), int32(y))
			} else {
				gl.Color3ub(50, 50, 50)
				gl.Vertex2i(int32(x), int32(y))
			}
		}
	}

	gl.End()
	glfw.PollEvents()
	s.window.SwapBuffers()
}

var up_key_presses = []io.KeyPress{
	io.KeyPress{0, false},
	io.KeyPress{1, false},
	io.KeyPress{2, false},
	io.KeyPress{3, false},
	io.KeyPress{4, false},
	io.KeyPress{5, false},
	io.KeyPress{6, false},
	io.KeyPress{7, false},
	io.KeyPress{8, false},
	io.KeyPress{9, false},
	io.KeyPress{10, false},
	io.KeyPress{11, false},
	io.KeyPress{12, false},
	io.KeyPress{13, false},
	io.KeyPress{14, false},
	io.KeyPress{15, false},
	io.KeyPress{16, false},
	io.KeyPress{17, false},
	io.KeyPress{18, false},
	io.KeyPress{19, false},
	io.KeyPress{20, false},
	io.KeyPress{21, false},
	io.KeyPress{22, false},
	io.KeyPress{23, false},
	io.KeyPress{24, false},
	io.KeyPress{25, false},
	io.KeyPress{26, false},
	io.KeyPress{27, false},
	io.KeyPress{28, false},
	io.KeyPress{29, false},
	io.KeyPress{30, false},
	io.KeyPress{31, false},
	io.KeyPress{32, false},
	io.KeyPress{33, false},
	io.KeyPress{34, false},
	io.KeyPress{35, false},
	io.KeyPress{36, false},
	io.KeyPress{37, false},
	io.KeyPress{38, false},
	io.KeyPress{39, false},
	io.KeyPress{40, false},
	io.KeyPress{41, false},
	io.KeyPress{42, false},
	io.KeyPress{43, false},
	io.KeyPress{44, false},
	io.KeyPress{45, false},
	io.KeyPress{46, false},
	io.KeyPress{47, false},
	io.KeyPress{48, false},
	io.KeyPress{49, false},
	io.KeyPress{50, false},
	io.KeyPress{51, false},
	io.KeyPress{52, false},
	io.KeyPress{53, false},
	io.KeyPress{54, false},
	io.KeyPress{55, false},
	io.KeyPress{56, false},
	io.KeyPress{57, false},
	io.KeyPress{58, false},
	io.KeyPress{59, false},
	io.KeyPress{60, false},
	io.KeyPress{61, false},
	io.KeyPress{62, false},
	io.KeyPress{63, false},
	io.KeyPress{64, false},
	io.KeyPress{65, false},
	io.KeyPress{66, false},
	io.KeyPress{67, false},
	io.KeyPress{68, false},
	io.KeyPress{69, false},
	io.KeyPress{70, false},
	io.KeyPress{71, false},
	io.KeyPress{72, false},
	io.KeyPress{73, false},
	io.KeyPress{74, false},
	io.KeyPress{75, false},
	io.KeyPress{76, false},
	io.KeyPress{77, false},
	io.KeyPress{78, false},
	io.KeyPress{79, false},
	io.KeyPress{80, false},
	io.KeyPress{81, false},
	io.KeyPress{82, false},
	io.KeyPress{83, false},
	io.KeyPress{84, false},
	io.KeyPress{85, false},
	io.KeyPress{86, false},
	io.KeyPress{87, false},
	io.KeyPress{88, false},
	io.KeyPress{89, false},
	io.KeyPress{90, false},
	io.KeyPress{91, false},
	io.KeyPress{92, false},
	io.KeyPress{93, false},
	io.KeyPress{94, false},
	io.KeyPress{95, false},
	io.KeyPress{96, false},
	io.KeyPress{97, false},
	io.KeyPress{98, false},
	io.KeyPress{99, false},
	io.KeyPress{100, false},
	io.KeyPress{101, false},
	io.KeyPress{102, false},
	io.KeyPress{103, false},
	io.KeyPress{104, false},
	io.KeyPress{105, false},
	io.KeyPress{106, false},
	io.KeyPress{107, false},
	io.KeyPress{108, false},
	io.KeyPress{109, false},
	io.KeyPress{110, false},
	io.KeyPress{111, false},
	io.KeyPress{112, false},
	io.KeyPress{113, false},
	io.KeyPress{114, false},
	io.KeyPress{115, false},
	io.KeyPress{116, false},
	io.KeyPress{117, false},
	io.KeyPress{118, false},
	io.KeyPress{119, false},
	io.KeyPress{120, false},
	io.KeyPress{121, false},
	io.KeyPress{122, false},
	io.KeyPress{123, false},
	io.KeyPress{124, false},
	io.KeyPress{125, false},
	io.KeyPress{126, false},
	io.KeyPress{127, false},
	io.KeyPress{128, false},
	io.KeyPress{129, false},
	io.KeyPress{130, false},
	io.KeyPress{131, false},
	io.KeyPress{132, false},
	io.KeyPress{133, false},
	io.KeyPress{134, false},
	io.KeyPress{135, false},
	io.KeyPress{136, false},
	io.KeyPress{137, false},
	io.KeyPress{138, false},
	io.KeyPress{139, false},
	io.KeyPress{140, false},
	io.KeyPress{141, false},
	io.KeyPress{142, false},
	io.KeyPress{143, false},
	io.KeyPress{144, false},
	io.KeyPress{145, false},
	io.KeyPress{146, false},
	io.KeyPress{147, false},
	io.KeyPress{148, false},
	io.KeyPress{149, false},
	io.KeyPress{150, false},
	io.KeyPress{151, false},
	io.KeyPress{152, false},
	io.KeyPress{153, false},
	io.KeyPress{154, false},
	io.KeyPress{155, false},
	io.KeyPress{156, false},
	io.KeyPress{157, false},
	io.KeyPress{158, false},
	io.KeyPress{159, false},
	io.KeyPress{160, false},
	io.KeyPress{161, false},
	io.KeyPress{162, false},
	io.KeyPress{163, false},
	io.KeyPress{164, false},
	io.KeyPress{165, false},
	io.KeyPress{166, false},
	io.KeyPress{167, false},
	io.KeyPress{168, false},
	io.KeyPress{169, false},
	io.KeyPress{170, false},
	io.KeyPress{171, false},
	io.KeyPress{172, false},
	io.KeyPress{173, false},
	io.KeyPress{174, false},
	io.KeyPress{175, false},
	io.KeyPress{176, false},
	io.KeyPress{177, false},
	io.KeyPress{178, false},
	io.KeyPress{179, false},
	io.KeyPress{180, false},
	io.KeyPress{181, false},
	io.KeyPress{182, false},
	io.KeyPress{183, false},
	io.KeyPress{184, false},
	io.KeyPress{185, false},
	io.KeyPress{186, false},
	io.KeyPress{187, false},
	io.KeyPress{188, false},
	io.KeyPress{189, false},
	io.KeyPress{190, false},
	io.KeyPress{191, false},
	io.KeyPress{192, false},
	io.KeyPress{193, false},
	io.KeyPress{194, false},
	io.KeyPress{195, false},
	io.KeyPress{196, false},
	io.KeyPress{197, false},
	io.KeyPress{198, false},
	io.KeyPress{199, false},
	io.KeyPress{200, false},
	io.KeyPress{201, false},
	io.KeyPress{202, false},
	io.KeyPress{203, false},
	io.KeyPress{204, false},
	io.KeyPress{205, false},
	io.KeyPress{206, false},
	io.KeyPress{207, false},
	io.KeyPress{208, false},
	io.KeyPress{209, false},
	io.KeyPress{210, false},
	io.KeyPress{211, false},
	io.KeyPress{212, false},
	io.KeyPress{213, false},
	io.KeyPress{214, false},
	io.KeyPress{215, false},
	io.KeyPress{216, false},
	io.KeyPress{217, false},
	io.KeyPress{218, false},
	io.KeyPress{219, false},
	io.KeyPress{220, false},
	io.KeyPress{221, false},
	io.KeyPress{222, false},
	io.KeyPress{223, false},
	io.KeyPress{224, false},
	io.KeyPress{225, false},
	io.KeyPress{226, false},
	io.KeyPress{227, false},
	io.KeyPress{228, false},
	io.KeyPress{229, false},
	io.KeyPress{230, false},
	io.KeyPress{231, false},
	io.KeyPress{232, false},
	io.KeyPress{233, false},
	io.KeyPress{234, false},
	io.KeyPress{235, false},
	io.KeyPress{236, false},
	io.KeyPress{237, false},
	io.KeyPress{238, false},
	io.KeyPress{239, false},
	io.KeyPress{240, false},
	io.KeyPress{241, false},
	io.KeyPress{242, false},
	io.KeyPress{243, false},
	io.KeyPress{244, false},
	io.KeyPress{245, false},
	io.KeyPress{246, false},
	io.KeyPress{247, false},
	io.KeyPress{248, false},
	io.KeyPress{249, false},
	io.KeyPress{250, false},
	io.KeyPress{251, false},
	io.KeyPress{252, false},
	io.KeyPress{253, false},
	io.KeyPress{254, false},
	io.KeyPress{255, false},
	io.KeyPress{256, false},
	io.KeyPress{257, false},
	io.KeyPress{258, false},
	io.KeyPress{259, false},
	io.KeyPress{260, false},
	io.KeyPress{261, false},
	io.KeyPress{262, false},
	io.KeyPress{263, false},
	io.KeyPress{264, false},
	io.KeyPress{265, false},
	io.KeyPress{266, false},
	io.KeyPress{267, false},
	io.KeyPress{268, false},
	io.KeyPress{269, false},
	io.KeyPress{270, false},
	io.KeyPress{271, false},
	io.KeyPress{272, false},
	io.KeyPress{273, false},
	io.KeyPress{274, false},
	io.KeyPress{275, false},
	io.KeyPress{276, false},
	io.KeyPress{277, false},
	io.KeyPress{278, false},
	io.KeyPress{279, false},
	io.KeyPress{280, false},
	io.KeyPress{281, false},
	io.KeyPress{282, false},
	io.KeyPress{283, false},
	io.KeyPress{284, false},
	io.KeyPress{285, false},
	io.KeyPress{286, false},
	io.KeyPress{287, false},
	io.KeyPress{288, false},
	io.KeyPress{289, false},
	io.KeyPress{290, false},
	io.KeyPress{291, false},
	io.KeyPress{292, false},
	io.KeyPress{293, false},
	io.KeyPress{294, false},
	io.KeyPress{295, false},
	io.KeyPress{296, false},
	io.KeyPress{297, false},
	io.KeyPress{298, false},
	io.KeyPress{299, false},
	io.KeyPress{300, false},
	io.KeyPress{301, false},
	io.KeyPress{302, false},
	io.KeyPress{303, false},
	io.KeyPress{304, false},
	io.KeyPress{305, false},
	io.KeyPress{306, false},
	io.KeyPress{307, false},
	io.KeyPress{308, false},
	io.KeyPress{309, false},
	io.KeyPress{310, false},
	io.KeyPress{311, false},
	io.KeyPress{312, false},
	io.KeyPress{313, false},
	io.KeyPress{314, false},
	io.KeyPress{315, false},
	io.KeyPress{316, false},
	io.KeyPress{317, false},
	io.KeyPress{318, false},
	io.KeyPress{319, false},
	io.KeyPress{320, false},
	io.KeyPress{321, false},
	io.KeyPress{322, false},
	io.KeyPress{323, false},
	io.KeyPress{324, false},
	io.KeyPress{325, false},
	io.KeyPress{326, false},
	io.KeyPress{327, false},
	io.KeyPress{328, false},
	io.KeyPress{329, false},
	io.KeyPress{330, false},
	io.KeyPress{331, false},
	io.KeyPress{332, false},
	io.KeyPress{333, false},
	io.KeyPress{334, false},
	io.KeyPress{335, false},
	io.KeyPress{336, false},
	io.KeyPress{337, false},
	io.KeyPress{338, false},
	io.KeyPress{339, false},
	io.KeyPress{340, false},
	io.KeyPress{341, false},
	io.KeyPress{342, false},
	io.KeyPress{343, false},
	io.KeyPress{344, false},
	io.KeyPress{345, false},
	io.KeyPress{346, false},
	io.KeyPress{347, false},
	io.KeyPress{348, false},
	io.KeyPress{349, false},
	io.KeyPress{350, false},
	io.KeyPress{351, false},
	io.KeyPress{352, false},
	io.KeyPress{353, false},
	io.KeyPress{354, false},
	io.KeyPress{355, false},
	io.KeyPress{356, false},
	io.KeyPress{357, false},
	io.KeyPress{358, false},
	io.KeyPress{359, false},
	io.KeyPress{360, false},
	io.KeyPress{361, false},
	io.KeyPress{362, false},
	io.KeyPress{363, false},
	io.KeyPress{364, false},
	io.KeyPress{365, false},
	io.KeyPress{366, false},
	io.KeyPress{367, false},
	io.KeyPress{368, false},
	io.KeyPress{369, false},
	io.KeyPress{370, false},
	io.KeyPress{371, false},
	io.KeyPress{372, false},
	io.KeyPress{373, false},
	io.KeyPress{374, false},
	io.KeyPress{375, false},
	io.KeyPress{376, false},
	io.KeyPress{377, false},
	io.KeyPress{378, false},
	io.KeyPress{379, false},
	io.KeyPress{380, false},
	io.KeyPress{381, false},
	io.KeyPress{382, false},
	io.KeyPress{383, false},
	io.KeyPress{384, false},
	io.KeyPress{385, false},
	io.KeyPress{386, false},
	io.KeyPress{387, false},
	io.KeyPress{388, false},
	io.KeyPress{389, false},
	io.KeyPress{390, false},
	io.KeyPress{391, false},
	io.KeyPress{392, false},
	io.KeyPress{393, false},
	io.KeyPress{394, false},
	io.KeyPress{395, false},
	io.KeyPress{396, false},
	io.KeyPress{397, false},
	io.KeyPress{398, false},
	io.KeyPress{399, false},
	io.KeyPress{400, false},
	io.KeyPress{401, false},
	io.KeyPress{402, false},
	io.KeyPress{403, false},
	io.KeyPress{404, false},
	io.KeyPress{405, false},
	io.KeyPress{406, false},
	io.KeyPress{407, false},
	io.KeyPress{408, false},
	io.KeyPress{409, false},
	io.KeyPress{410, false},
	io.KeyPress{411, false},
	io.KeyPress{412, false},
	io.KeyPress{413, false},
	io.KeyPress{414, false},
	io.KeyPress{415, false},
	io.KeyPress{416, false},
	io.KeyPress{417, false},
	io.KeyPress{418, false},
	io.KeyPress{419, false},
	io.KeyPress{420, false},
	io.KeyPress{421, false},
	io.KeyPress{422, false},
	io.KeyPress{423, false},
	io.KeyPress{424, false},
	io.KeyPress{425, false},
	io.KeyPress{426, false},
	io.KeyPress{427, false},
	io.KeyPress{428, false},
	io.KeyPress{429, false},
	io.KeyPress{430, false},
	io.KeyPress{431, false},
	io.KeyPress{432, false},
	io.KeyPress{433, false},
	io.KeyPress{434, false},
	io.KeyPress{435, false},
	io.KeyPress{436, false},
	io.KeyPress{437, false},
	io.KeyPress{438, false},
	io.KeyPress{439, false},
	io.KeyPress{440, false},
	io.KeyPress{441, false},
	io.KeyPress{442, false},
	io.KeyPress{443, false},
	io.KeyPress{444, false},
	io.KeyPress{445, false},
	io.KeyPress{446, false},
	io.KeyPress{447, false},
	io.KeyPress{448, false},
	io.KeyPress{449, false},
	io.KeyPress{450, false},
	io.KeyPress{451, false},
	io.KeyPress{452, false},
	io.KeyPress{453, false},
	io.KeyPress{454, false},
	io.KeyPress{455, false},
	io.KeyPress{456, false},
	io.KeyPress{457, false},
	io.KeyPress{458, false},
	io.KeyPress{459, false},
	io.KeyPress{460, false},
	io.KeyPress{461, false},
	io.KeyPress{462, false},
	io.KeyPress{463, false},
	io.KeyPress{464, false},
	io.KeyPress{465, false},
	io.KeyPress{466, false},
	io.KeyPress{467, false},
	io.KeyPress{468, false},
	io.KeyPress{469, false},
	io.KeyPress{470, false},
	io.KeyPress{471, false},
	io.KeyPress{472, false},
	io.KeyPress{473, false},
	io.KeyPress{474, false},
	io.KeyPress{475, false},
	io.KeyPress{476, false},
	io.KeyPress{477, false},
	io.KeyPress{478, false},
	io.KeyPress{479, false},
	io.KeyPress{480, false},
	io.KeyPress{481, false},
	io.KeyPress{482, false},
	io.KeyPress{483, false},
	io.KeyPress{484, false},
	io.KeyPress{485, false},
	io.KeyPress{486, false},
	io.KeyPress{487, false},
	io.KeyPress{488, false},
	io.KeyPress{489, false},
	io.KeyPress{490, false},
	io.KeyPress{491, false},
	io.KeyPress{492, false},
	io.KeyPress{493, false},
	io.KeyPress{494, false},
	io.KeyPress{495, false},
	io.KeyPress{496, false},
	io.KeyPress{497, false},
	io.KeyPress{498, false},
	io.KeyPress{499, false},
	io.KeyPress{500, false},
	io.KeyPress{501, false},
	io.KeyPress{502, false},
	io.KeyPress{503, false},
	io.KeyPress{504, false},
	io.KeyPress{505, false},
	io.KeyPress{506, false},
	io.KeyPress{507, false},
	io.KeyPress{508, false},
	io.KeyPress{509, false},
	io.KeyPress{510, false},
	io.KeyPress{511, false},
	io.KeyPress{512, false},
	io.KeyPress{513, false},
	io.KeyPress{514, false},
	io.KeyPress{515, false},
	io.KeyPress{516, false},
	io.KeyPress{517, false},
	io.KeyPress{518, false},
	io.KeyPress{519, false},
	io.KeyPress{520, false},
	io.KeyPress{521, false},
	io.KeyPress{522, false},
	io.KeyPress{523, false},
	io.KeyPress{524, false},
	io.KeyPress{525, false},
	io.KeyPress{526, false},
	io.KeyPress{527, false},
	io.KeyPress{528, false},
	io.KeyPress{529, false},
	io.KeyPress{530, false},
	io.KeyPress{531, false},
	io.KeyPress{532, false},
	io.KeyPress{533, false},
	io.KeyPress{534, false},
	io.KeyPress{535, false},
	io.KeyPress{536, false},
	io.KeyPress{537, false},
	io.KeyPress{538, false},
	io.KeyPress{539, false},
	io.KeyPress{540, false},
	io.KeyPress{541, false},
	io.KeyPress{542, false},
	io.KeyPress{543, false},
	io.KeyPress{544, false},
	io.KeyPress{545, false},
	io.KeyPress{546, false},
	io.KeyPress{547, false},
	io.KeyPress{548, false},
	io.KeyPress{549, false},
	io.KeyPress{550, false},
	io.KeyPress{551, false},
	io.KeyPress{552, false},
	io.KeyPress{553, false},
	io.KeyPress{554, false},
	io.KeyPress{555, false},
	io.KeyPress{556, false},
	io.KeyPress{557, false},
	io.KeyPress{558, false},
	io.KeyPress{559, false},
	io.KeyPress{560, false},
	io.KeyPress{561, false},
	io.KeyPress{562, false},
	io.KeyPress{563, false},
	io.KeyPress{564, false},
	io.KeyPress{565, false},
	io.KeyPress{566, false},
	io.KeyPress{567, false},
	io.KeyPress{568, false},
	io.KeyPress{569, false},
	io.KeyPress{570, false},
	io.KeyPress{571, false},
	io.KeyPress{572, false},
	io.KeyPress{573, false},
	io.KeyPress{574, false},
	io.KeyPress{575, false},
	io.KeyPress{576, false},
	io.KeyPress{577, false},
	io.KeyPress{578, false},
	io.KeyPress{579, false},
	io.KeyPress{580, false},
	io.KeyPress{581, false},
	io.KeyPress{582, false},
	io.KeyPress{583, false},
	io.KeyPress{584, false},
	io.KeyPress{585, false},
	io.KeyPress{586, false},
	io.KeyPress{587, false},
	io.KeyPress{588, false},
	io.KeyPress{589, false},
	io.KeyPress{590, false},
	io.KeyPress{591, false},
	io.KeyPress{592, false},
	io.KeyPress{593, false},
	io.KeyPress{594, false},
	io.KeyPress{595, false},
	io.KeyPress{596, false},
	io.KeyPress{597, false},
	io.KeyPress{598, false},
	io.KeyPress{599, false},
	io.KeyPress{600, false},
	io.KeyPress{601, false},
	io.KeyPress{602, false},
	io.KeyPress{603, false},
	io.KeyPress{604, false},
	io.KeyPress{605, false},
	io.KeyPress{606, false},
	io.KeyPress{607, false},
	io.KeyPress{608, false},
	io.KeyPress{609, false},
	io.KeyPress{610, false},
	io.KeyPress{611, false},
	io.KeyPress{612, false},
	io.KeyPress{613, false},
	io.KeyPress{614, false},
	io.KeyPress{615, false},
	io.KeyPress{616, false},
	io.KeyPress{617, false},
	io.KeyPress{618, false},
	io.KeyPress{619, false},
	io.KeyPress{620, false},
	io.KeyPress{621, false},
	io.KeyPress{622, false},
	io.KeyPress{623, false},
	io.KeyPress{624, false},
	io.KeyPress{625, false},
	io.KeyPress{626, false},
	io.KeyPress{627, false},
	io.KeyPress{628, false},
	io.KeyPress{629, false},
	io.KeyPress{630, false},
	io.KeyPress{631, false},
	io.KeyPress{632, false},
	io.KeyPress{633, false},
	io.KeyPress{634, false},
	io.KeyPress{635, false},
	io.KeyPress{636, false},
	io.KeyPress{637, false},
	io.KeyPress{638, false},
	io.KeyPress{639, false},
	io.KeyPress{640, false},
	io.KeyPress{641, false},
	io.KeyPress{642, false},
	io.KeyPress{643, false},
	io.KeyPress{644, false},
	io.KeyPress{645, false},
	io.KeyPress{646, false},
	io.KeyPress{647, false},
	io.KeyPress{648, false},
	io.KeyPress{649, false},
	io.KeyPress{650, false},
	io.KeyPress{651, false},
	io.KeyPress{652, false},
	io.KeyPress{653, false},
	io.KeyPress{654, false},
	io.KeyPress{655, false},
	io.KeyPress{656, false},
	io.KeyPress{657, false},
	io.KeyPress{658, false},
	io.KeyPress{659, false},
	io.KeyPress{660, false},
	io.KeyPress{661, false},
	io.KeyPress{662, false},
	io.KeyPress{663, false},
	io.KeyPress{664, false},
	io.KeyPress{665, false},
	io.KeyPress{666, false},
	io.KeyPress{667, false},
	io.KeyPress{668, false},
	io.KeyPress{669, false},
	io.KeyPress{670, false},
	io.KeyPress{671, false},
	io.KeyPress{672, false},
	io.KeyPress{673, false},
	io.KeyPress{674, false},
	io.KeyPress{675, false},
	io.KeyPress{676, false},
	io.KeyPress{677, false},
	io.KeyPress{678, false},
	io.KeyPress{679, false},
	io.KeyPress{680, false},
	io.KeyPress{681, false},
	io.KeyPress{682, false},
	io.KeyPress{683, false},
	io.KeyPress{684, false},
	io.KeyPress{685, false},
	io.KeyPress{686, false},
	io.KeyPress{687, false},
	io.KeyPress{688, false},
	io.KeyPress{689, false},
	io.KeyPress{690, false},
	io.KeyPress{691, false},
	io.KeyPress{692, false},
	io.KeyPress{693, false},
	io.KeyPress{694, false},
	io.KeyPress{695, false},
	io.KeyPress{696, false},
	io.KeyPress{697, false},
	io.KeyPress{698, false},
	io.KeyPress{699, false},
	io.KeyPress{700, false},
	io.KeyPress{701, false},
	io.KeyPress{702, false},
	io.KeyPress{703, false},
	io.KeyPress{704, false},
	io.KeyPress{705, false},
	io.KeyPress{706, false},
	io.KeyPress{707, false},
	io.KeyPress{708, false},
	io.KeyPress{709, false},
	io.KeyPress{710, false},
	io.KeyPress{711, false},
	io.KeyPress{712, false},
	io.KeyPress{713, false},
	io.KeyPress{714, false},
	io.KeyPress{715, false},
	io.KeyPress{716, false},
	io.KeyPress{717, false},
	io.KeyPress{718, false},
	io.KeyPress{719, false},
	io.KeyPress{720, false},
	io.KeyPress{721, false},
	io.KeyPress{722, false},
	io.KeyPress{723, false},
	io.KeyPress{724, false},
	io.KeyPress{725, false},
	io.KeyPress{726, false},
	io.KeyPress{727, false},
	io.KeyPress{728, false},
	io.KeyPress{729, false},
	io.KeyPress{730, false},
	io.KeyPress{731, false},
	io.KeyPress{732, false},
	io.KeyPress{733, false},
	io.KeyPress{734, false},
	io.KeyPress{735, false},
	io.KeyPress{736, false},
	io.KeyPress{737, false},
	io.KeyPress{738, false},
	io.KeyPress{739, false},
	io.KeyPress{740, false},
	io.KeyPress{741, false},
	io.KeyPress{742, false},
	io.KeyPress{743, false},
	io.KeyPress{744, false},
	io.KeyPress{745, false},
	io.KeyPress{746, false},
	io.KeyPress{747, false},
	io.KeyPress{748, false},
	io.KeyPress{749, false},
	io.KeyPress{750, false},
	io.KeyPress{751, false},
	io.KeyPress{752, false},
	io.KeyPress{753, false},
	io.KeyPress{754, false},
	io.KeyPress{755, false},
	io.KeyPress{756, false},
	io.KeyPress{757, false},
	io.KeyPress{758, false},
	io.KeyPress{759, false},
	io.KeyPress{760, false},
	io.KeyPress{761, false},
	io.KeyPress{762, false},
	io.KeyPress{763, false},
	io.KeyPress{764, false},
	io.KeyPress{765, false},
	io.KeyPress{766, false},
	io.KeyPress{767, false},
	io.KeyPress{768, false},
	io.KeyPress{769, false},
	io.KeyPress{770, false},
	io.KeyPress{771, false},
	io.KeyPress{772, false},
	io.KeyPress{773, false},
	io.KeyPress{774, false},
	io.KeyPress{775, false},
	io.KeyPress{776, false},
	io.KeyPress{777, false},
	io.KeyPress{778, false},
	io.KeyPress{779, false},
	io.KeyPress{780, false},
	io.KeyPress{781, false},
	io.KeyPress{782, false},
	io.KeyPress{783, false},
	io.KeyPress{784, false},
	io.KeyPress{785, false},
	io.KeyPress{786, false},
	io.KeyPress{787, false},
	io.KeyPress{788, false},
	io.KeyPress{789, false},
	io.KeyPress{790, false},
	io.KeyPress{791, false},
	io.KeyPress{792, false},
	io.KeyPress{793, false},
	io.KeyPress{794, false},
	io.KeyPress{795, false},
	io.KeyPress{796, false},
	io.KeyPress{797, false},
	io.KeyPress{798, false},
	io.KeyPress{799, false},
	io.KeyPress{800, false},
	io.KeyPress{801, false},
	io.KeyPress{802, false},
	io.KeyPress{803, false},
	io.KeyPress{804, false},
	io.KeyPress{805, false},
	io.KeyPress{806, false},
	io.KeyPress{807, false},
	io.KeyPress{808, false},
	io.KeyPress{809, false},
	io.KeyPress{810, false},
	io.KeyPress{811, false},
	io.KeyPress{812, false},
	io.KeyPress{813, false},
	io.KeyPress{814, false},
	io.KeyPress{815, false},
	io.KeyPress{816, false},
	io.KeyPress{817, false},
	io.KeyPress{818, false},
	io.KeyPress{819, false},
	io.KeyPress{820, false},
	io.KeyPress{821, false},
	io.KeyPress{822, false},
	io.KeyPress{823, false},
	io.KeyPress{824, false},
	io.KeyPress{825, false},
	io.KeyPress{826, false},
	io.KeyPress{827, false},
	io.KeyPress{828, false},
	io.KeyPress{829, false},
	io.KeyPress{830, false},
	io.KeyPress{831, false},
	io.KeyPress{832, false},
	io.KeyPress{833, false},
	io.KeyPress{834, false},
	io.KeyPress{835, false},
	io.KeyPress{836, false},
	io.KeyPress{837, false},
	io.KeyPress{838, false},
	io.KeyPress{839, false},
	io.KeyPress{840, false},
	io.KeyPress{841, false},
	io.KeyPress{842, false},
	io.KeyPress{843, false},
	io.KeyPress{844, false},
	io.KeyPress{845, false},
	io.KeyPress{846, false},
	io.KeyPress{847, false},
	io.KeyPress{848, false},
	io.KeyPress{849, false},
	io.KeyPress{850, false},
	io.KeyPress{851, false},
	io.KeyPress{852, false},
	io.KeyPress{853, false},
	io.KeyPress{854, false},
	io.KeyPress{855, false},
	io.KeyPress{856, false},
	io.KeyPress{857, false},
	io.KeyPress{858, false},
	io.KeyPress{859, false},
	io.KeyPress{860, false},
	io.KeyPress{861, false},
	io.KeyPress{862, false},
	io.KeyPress{863, false},
	io.KeyPress{864, false},
	io.KeyPress{865, false},
	io.KeyPress{866, false},
	io.KeyPress{867, false},
	io.KeyPress{868, false},
	io.KeyPress{869, false},
	io.KeyPress{870, false},
	io.KeyPress{871, false},
	io.KeyPress{872, false},
	io.KeyPress{873, false},
	io.KeyPress{874, false},
	io.KeyPress{875, false},
	io.KeyPress{876, false},
	io.KeyPress{877, false},
	io.KeyPress{878, false},
	io.KeyPress{879, false},
	io.KeyPress{880, false},
	io.KeyPress{881, false},
	io.KeyPress{882, false},
	io.KeyPress{883, false},
	io.KeyPress{884, false},
	io.KeyPress{885, false},
	io.KeyPress{886, false},
	io.KeyPress{887, false},
	io.KeyPress{888, false},
	io.KeyPress{889, false},
	io.KeyPress{890, false},
	io.KeyPress{891, false},
	io.KeyPress{892, false},
	io.KeyPress{893, false},
	io.KeyPress{894, false},
	io.KeyPress{895, false},
	io.KeyPress{896, false},
	io.KeyPress{897, false},
	io.KeyPress{898, false},
	io.KeyPress{899, false},
	io.KeyPress{900, false},
	io.KeyPress{901, false},
	io.KeyPress{902, false},
	io.KeyPress{903, false},
	io.KeyPress{904, false},
	io.KeyPress{905, false},
	io.KeyPress{906, false},
	io.KeyPress{907, false},
	io.KeyPress{908, false},
	io.KeyPress{909, false},
	io.KeyPress{910, false},
	io.KeyPress{911, false},
	io.KeyPress{912, false},
	io.KeyPress{913, false},
	io.KeyPress{914, false},
	io.KeyPress{915, false},
	io.KeyPress{916, false},
	io.KeyPress{917, false},
	io.KeyPress{918, false},
	io.KeyPress{919, false},
	io.KeyPress{920, false},
	io.KeyPress{921, false},
	io.KeyPress{922, false},
	io.KeyPress{923, false},
	io.KeyPress{924, false},
	io.KeyPress{925, false},
	io.KeyPress{926, false},
	io.KeyPress{927, false},
	io.KeyPress{928, false},
	io.KeyPress{929, false},
	io.KeyPress{930, false},
	io.KeyPress{931, false},
	io.KeyPress{932, false},
	io.KeyPress{933, false},
	io.KeyPress{934, false},
	io.KeyPress{935, false},
	io.KeyPress{936, false},
	io.KeyPress{937, false},
	io.KeyPress{938, false},
	io.KeyPress{939, false},
	io.KeyPress{940, false},
	io.KeyPress{941, false},
	io.KeyPress{942, false},
	io.KeyPress{943, false},
	io.KeyPress{944, false},
	io.KeyPress{945, false},
	io.KeyPress{946, false},
	io.KeyPress{947, false},
	io.KeyPress{948, false},
	io.KeyPress{949, false},
	io.KeyPress{950, false},
	io.KeyPress{951, false},
	io.KeyPress{952, false},
	io.KeyPress{953, false},
	io.KeyPress{954, false},
	io.KeyPress{955, false},
	io.KeyPress{956, false},
	io.KeyPress{957, false},
	io.KeyPress{958, false},
	io.KeyPress{959, false},
	io.KeyPress{960, false},
	io.KeyPress{961, false},
	io.KeyPress{962, false},
	io.KeyPress{963, false},
	io.KeyPress{964, false},
	io.KeyPress{965, false},
	io.KeyPress{966, false},
	io.KeyPress{967, false},
	io.KeyPress{968, false},
	io.KeyPress{969, false},
	io.KeyPress{970, false},
	io.KeyPress{971, false},
	io.KeyPress{972, false},
	io.KeyPress{973, false},
	io.KeyPress{974, false},
	io.KeyPress{975, false},
	io.KeyPress{976, false},
	io.KeyPress{977, false},
	io.KeyPress{978, false},
	io.KeyPress{979, false},
	io.KeyPress{980, false},
	io.KeyPress{981, false},
	io.KeyPress{982, false},
	io.KeyPress{983, false},
	io.KeyPress{984, false},
	io.KeyPress{985, false},
	io.KeyPress{986, false},
	io.KeyPress{987, false},
	io.KeyPress{988, false},
	io.KeyPress{989, false},
	io.KeyPress{990, false},
	io.KeyPress{991, false},
	io.KeyPress{992, false},
	io.KeyPress{993, false},
	io.KeyPress{994, false},
	io.KeyPress{995, false},
	io.KeyPress{996, false},
	io.KeyPress{997, false},
	io.KeyPress{998, false},
	io.KeyPress{999, false},
	io.KeyPress{1000, false},
	io.KeyPress{1001, false},
	io.KeyPress{1002, false},
	io.KeyPress{1003, false},
	io.KeyPress{1004, false},
	io.KeyPress{1005, false},
	io.KeyPress{1006, false},
	io.KeyPress{1007, false},
	io.KeyPress{1008, false},
	io.KeyPress{1009, false},
	io.KeyPress{1010, false},
	io.KeyPress{1011, false},
	io.KeyPress{1012, false},
	io.KeyPress{1013, false},
	io.KeyPress{1014, false},
	io.KeyPress{1015, false},
	io.KeyPress{1016, false},
	io.KeyPress{1017, false},
	io.KeyPress{1018, false},
	io.KeyPress{1019, false},
	io.KeyPress{1020, false},
	io.KeyPress{1021, false},
	io.KeyPress{1022, false},
	io.KeyPress{1023, false},
}

var down_key_presses = []io.KeyPress{
	io.KeyPress{0, true},
	io.KeyPress{1, true},
	io.KeyPress{2, true},
	io.KeyPress{3, true},
	io.KeyPress{4, true},
	io.KeyPress{5, true},
	io.KeyPress{6, true},
	io.KeyPress{7, true},
	io.KeyPress{8, true},
	io.KeyPress{9, true},
	io.KeyPress{10, true},
	io.KeyPress{11, true},
	io.KeyPress{12, true},
	io.KeyPress{13, true},
	io.KeyPress{14, true},
	io.KeyPress{15, true},
	io.KeyPress{16, true},
	io.KeyPress{17, true},
	io.KeyPress{18, true},
	io.KeyPress{19, true},
	io.KeyPress{20, true},
	io.KeyPress{21, true},
	io.KeyPress{22, true},
	io.KeyPress{23, true},
	io.KeyPress{24, true},
	io.KeyPress{25, true},
	io.KeyPress{26, true},
	io.KeyPress{27, true},
	io.KeyPress{28, true},
	io.KeyPress{29, true},
	io.KeyPress{30, true},
	io.KeyPress{31, true},
	io.KeyPress{32, true},
	io.KeyPress{33, true},
	io.KeyPress{34, true},
	io.KeyPress{35, true},
	io.KeyPress{36, true},
	io.KeyPress{37, true},
	io.KeyPress{38, true},
	io.KeyPress{39, true},
	io.KeyPress{40, true},
	io.KeyPress{41, true},
	io.KeyPress{42, true},
	io.KeyPress{43, true},
	io.KeyPress{44, true},
	io.KeyPress{45, true},
	io.KeyPress{46, true},
	io.KeyPress{47, true},
	io.KeyPress{48, true},
	io.KeyPress{49, true},
	io.KeyPress{50, true},
	io.KeyPress{51, true},
	io.KeyPress{52, true},
	io.KeyPress{53, true},
	io.KeyPress{54, true},
	io.KeyPress{55, true},
	io.KeyPress{56, true},
	io.KeyPress{57, true},
	io.KeyPress{58, true},
	io.KeyPress{59, true},
	io.KeyPress{60, true},
	io.KeyPress{61, true},
	io.KeyPress{62, true},
	io.KeyPress{63, true},
	io.KeyPress{64, true},
	io.KeyPress{65, true},
	io.KeyPress{66, true},
	io.KeyPress{67, true},
	io.KeyPress{68, true},
	io.KeyPress{69, true},
	io.KeyPress{70, true},
	io.KeyPress{71, true},
	io.KeyPress{72, true},
	io.KeyPress{73, true},
	io.KeyPress{74, true},
	io.KeyPress{75, true},
	io.KeyPress{76, true},
	io.KeyPress{77, true},
	io.KeyPress{78, true},
	io.KeyPress{79, true},
	io.KeyPress{80, true},
	io.KeyPress{81, true},
	io.KeyPress{82, true},
	io.KeyPress{83, true},
	io.KeyPress{84, true},
	io.KeyPress{85, true},
	io.KeyPress{86, true},
	io.KeyPress{87, true},
	io.KeyPress{88, true},
	io.KeyPress{89, true},
	io.KeyPress{90, true},
	io.KeyPress{91, true},
	io.KeyPress{92, true},
	io.KeyPress{93, true},
	io.KeyPress{94, true},
	io.KeyPress{95, true},
	io.KeyPress{96, true},
	io.KeyPress{97, true},
	io.KeyPress{98, true},
	io.KeyPress{99, true},
	io.KeyPress{100, true},
	io.KeyPress{101, true},
	io.KeyPress{102, true},
	io.KeyPress{103, true},
	io.KeyPress{104, true},
	io.KeyPress{105, true},
	io.KeyPress{106, true},
	io.KeyPress{107, true},
	io.KeyPress{108, true},
	io.KeyPress{109, true},
	io.KeyPress{110, true},
	io.KeyPress{111, true},
	io.KeyPress{112, true},
	io.KeyPress{113, true},
	io.KeyPress{114, true},
	io.KeyPress{115, true},
	io.KeyPress{116, true},
	io.KeyPress{117, true},
	io.KeyPress{118, true},
	io.KeyPress{119, true},
	io.KeyPress{120, true},
	io.KeyPress{121, true},
	io.KeyPress{122, true},
	io.KeyPress{123, true},
	io.KeyPress{124, true},
	io.KeyPress{125, true},
	io.KeyPress{126, true},
	io.KeyPress{127, true},
	io.KeyPress{128, true},
	io.KeyPress{129, true},
	io.KeyPress{130, true},
	io.KeyPress{131, true},
	io.KeyPress{132, true},
	io.KeyPress{133, true},
	io.KeyPress{134, true},
	io.KeyPress{135, true},
	io.KeyPress{136, true},
	io.KeyPress{137, true},
	io.KeyPress{138, true},
	io.KeyPress{139, true},
	io.KeyPress{140, true},
	io.KeyPress{141, true},
	io.KeyPress{142, true},
	io.KeyPress{143, true},
	io.KeyPress{144, true},
	io.KeyPress{145, true},
	io.KeyPress{146, true},
	io.KeyPress{147, true},
	io.KeyPress{148, true},
	io.KeyPress{149, true},
	io.KeyPress{150, true},
	io.KeyPress{151, true},
	io.KeyPress{152, true},
	io.KeyPress{153, true},
	io.KeyPress{154, true},
	io.KeyPress{155, true},
	io.KeyPress{156, true},
	io.KeyPress{157, true},
	io.KeyPress{158, true},
	io.KeyPress{159, true},
	io.KeyPress{160, true},
	io.KeyPress{161, true},
	io.KeyPress{162, true},
	io.KeyPress{163, true},
	io.KeyPress{164, true},
	io.KeyPress{165, true},
	io.KeyPress{166, true},
	io.KeyPress{167, true},
	io.KeyPress{168, true},
	io.KeyPress{169, true},
	io.KeyPress{170, true},
	io.KeyPress{171, true},
	io.KeyPress{172, true},
	io.KeyPress{173, true},
	io.KeyPress{174, true},
	io.KeyPress{175, true},
	io.KeyPress{176, true},
	io.KeyPress{177, true},
	io.KeyPress{178, true},
	io.KeyPress{179, true},
	io.KeyPress{180, true},
	io.KeyPress{181, true},
	io.KeyPress{182, true},
	io.KeyPress{183, true},
	io.KeyPress{184, true},
	io.KeyPress{185, true},
	io.KeyPress{186, true},
	io.KeyPress{187, true},
	io.KeyPress{188, true},
	io.KeyPress{189, true},
	io.KeyPress{190, true},
	io.KeyPress{191, true},
	io.KeyPress{192, true},
	io.KeyPress{193, true},
	io.KeyPress{194, true},
	io.KeyPress{195, true},
	io.KeyPress{196, true},
	io.KeyPress{197, true},
	io.KeyPress{198, true},
	io.KeyPress{199, true},
	io.KeyPress{200, true},
	io.KeyPress{201, true},
	io.KeyPress{202, true},
	io.KeyPress{203, true},
	io.KeyPress{204, true},
	io.KeyPress{205, true},
	io.KeyPress{206, true},
	io.KeyPress{207, true},
	io.KeyPress{208, true},
	io.KeyPress{209, true},
	io.KeyPress{210, true},
	io.KeyPress{211, true},
	io.KeyPress{212, true},
	io.KeyPress{213, true},
	io.KeyPress{214, true},
	io.KeyPress{215, true},
	io.KeyPress{216, true},
	io.KeyPress{217, true},
	io.KeyPress{218, true},
	io.KeyPress{219, true},
	io.KeyPress{220, true},
	io.KeyPress{221, true},
	io.KeyPress{222, true},
	io.KeyPress{223, true},
	io.KeyPress{224, true},
	io.KeyPress{225, true},
	io.KeyPress{226, true},
	io.KeyPress{227, true},
	io.KeyPress{228, true},
	io.KeyPress{229, true},
	io.KeyPress{230, true},
	io.KeyPress{231, true},
	io.KeyPress{232, true},
	io.KeyPress{233, true},
	io.KeyPress{234, true},
	io.KeyPress{235, true},
	io.KeyPress{236, true},
	io.KeyPress{237, true},
	io.KeyPress{238, true},
	io.KeyPress{239, true},
	io.KeyPress{240, true},
	io.KeyPress{241, true},
	io.KeyPress{242, true},
	io.KeyPress{243, true},
	io.KeyPress{244, true},
	io.KeyPress{245, true},
	io.KeyPress{246, true},
	io.KeyPress{247, true},
	io.KeyPress{248, true},
	io.KeyPress{249, true},
	io.KeyPress{250, true},
	io.KeyPress{251, true},
	io.KeyPress{252, true},
	io.KeyPress{253, true},
	io.KeyPress{254, true},
	io.KeyPress{255, true},
	io.KeyPress{256, true},
	io.KeyPress{257, true},
	io.KeyPress{258, true},
	io.KeyPress{259, true},
	io.KeyPress{260, true},
	io.KeyPress{261, true},
	io.KeyPress{262, true},
	io.KeyPress{263, true},
	io.KeyPress{264, true},
	io.KeyPress{265, true},
	io.KeyPress{266, true},
	io.KeyPress{267, true},
	io.KeyPress{268, true},
	io.KeyPress{269, true},
	io.KeyPress{270, true},
	io.KeyPress{271, true},
	io.KeyPress{272, true},
	io.KeyPress{273, true},
	io.KeyPress{274, true},
	io.KeyPress{275, true},
	io.KeyPress{276, true},
	io.KeyPress{277, true},
	io.KeyPress{278, true},
	io.KeyPress{279, true},
	io.KeyPress{280, true},
	io.KeyPress{281, true},
	io.KeyPress{282, true},
	io.KeyPress{283, true},
	io.KeyPress{284, true},
	io.KeyPress{285, true},
	io.KeyPress{286, true},
	io.KeyPress{287, true},
	io.KeyPress{288, true},
	io.KeyPress{289, true},
	io.KeyPress{290, true},
	io.KeyPress{291, true},
	io.KeyPress{292, true},
	io.KeyPress{293, true},
	io.KeyPress{294, true},
	io.KeyPress{295, true},
	io.KeyPress{296, true},
	io.KeyPress{297, true},
	io.KeyPress{298, true},
	io.KeyPress{299, true},
	io.KeyPress{300, true},
	io.KeyPress{301, true},
	io.KeyPress{302, true},
	io.KeyPress{303, true},
	io.KeyPress{304, true},
	io.KeyPress{305, true},
	io.KeyPress{306, true},
	io.KeyPress{307, true},
	io.KeyPress{308, true},
	io.KeyPress{309, true},
	io.KeyPress{310, true},
	io.KeyPress{311, true},
	io.KeyPress{312, true},
	io.KeyPress{313, true},
	io.KeyPress{314, true},
	io.KeyPress{315, true},
	io.KeyPress{316, true},
	io.KeyPress{317, true},
	io.KeyPress{318, true},
	io.KeyPress{319, true},
	io.KeyPress{320, true},
	io.KeyPress{321, true},
	io.KeyPress{322, true},
	io.KeyPress{323, true},
	io.KeyPress{324, true},
	io.KeyPress{325, true},
	io.KeyPress{326, true},
	io.KeyPress{327, true},
	io.KeyPress{328, true},
	io.KeyPress{329, true},
	io.KeyPress{330, true},
	io.KeyPress{331, true},
	io.KeyPress{332, true},
	io.KeyPress{333, true},
	io.KeyPress{334, true},
	io.KeyPress{335, true},
	io.KeyPress{336, true},
	io.KeyPress{337, true},
	io.KeyPress{338, true},
	io.KeyPress{339, true},
	io.KeyPress{340, true},
	io.KeyPress{341, true},
	io.KeyPress{342, true},
	io.KeyPress{343, true},
	io.KeyPress{344, true},
	io.KeyPress{345, true},
	io.KeyPress{346, true},
	io.KeyPress{347, true},
	io.KeyPress{348, true},
	io.KeyPress{349, true},
	io.KeyPress{350, true},
	io.KeyPress{351, true},
	io.KeyPress{352, true},
	io.KeyPress{353, true},
	io.KeyPress{354, true},
	io.KeyPress{355, true},
	io.KeyPress{356, true},
	io.KeyPress{357, true},
	io.KeyPress{358, true},
	io.KeyPress{359, true},
	io.KeyPress{360, true},
	io.KeyPress{361, true},
	io.KeyPress{362, true},
	io.KeyPress{363, true},
	io.KeyPress{364, true},
	io.KeyPress{365, true},
	io.KeyPress{366, true},
	io.KeyPress{367, true},
	io.KeyPress{368, true},
	io.KeyPress{369, true},
	io.KeyPress{370, true},
	io.KeyPress{371, true},
	io.KeyPress{372, true},
	io.KeyPress{373, true},
	io.KeyPress{374, true},
	io.KeyPress{375, true},
	io.KeyPress{376, true},
	io.KeyPress{377, true},
	io.KeyPress{378, true},
	io.KeyPress{379, true},
	io.KeyPress{380, true},
	io.KeyPress{381, true},
	io.KeyPress{382, true},
	io.KeyPress{383, true},
	io.KeyPress{384, true},
	io.KeyPress{385, true},
	io.KeyPress{386, true},
	io.KeyPress{387, true},
	io.KeyPress{388, true},
	io.KeyPress{389, true},
	io.KeyPress{390, true},
	io.KeyPress{391, true},
	io.KeyPress{392, true},
	io.KeyPress{393, true},
	io.KeyPress{394, true},
	io.KeyPress{395, true},
	io.KeyPress{396, true},
	io.KeyPress{397, true},
	io.KeyPress{398, true},
	io.KeyPress{399, true},
	io.KeyPress{400, true},
	io.KeyPress{401, true},
	io.KeyPress{402, true},
	io.KeyPress{403, true},
	io.KeyPress{404, true},
	io.KeyPress{405, true},
	io.KeyPress{406, true},
	io.KeyPress{407, true},
	io.KeyPress{408, true},
	io.KeyPress{409, true},
	io.KeyPress{410, true},
	io.KeyPress{411, true},
	io.KeyPress{412, true},
	io.KeyPress{413, true},
	io.KeyPress{414, true},
	io.KeyPress{415, true},
	io.KeyPress{416, true},
	io.KeyPress{417, true},
	io.KeyPress{418, true},
	io.KeyPress{419, true},
	io.KeyPress{420, true},
	io.KeyPress{421, true},
	io.KeyPress{422, true},
	io.KeyPress{423, true},
	io.KeyPress{424, true},
	io.KeyPress{425, true},
	io.KeyPress{426, true},
	io.KeyPress{427, true},
	io.KeyPress{428, true},
	io.KeyPress{429, true},
	io.KeyPress{430, true},
	io.KeyPress{431, true},
	io.KeyPress{432, true},
	io.KeyPress{433, true},
	io.KeyPress{434, true},
	io.KeyPress{435, true},
	io.KeyPress{436, true},
	io.KeyPress{437, true},
	io.KeyPress{438, true},
	io.KeyPress{439, true},
	io.KeyPress{440, true},
	io.KeyPress{441, true},
	io.KeyPress{442, true},
	io.KeyPress{443, true},
	io.KeyPress{444, true},
	io.KeyPress{445, true},
	io.KeyPress{446, true},
	io.KeyPress{447, true},
	io.KeyPress{448, true},
	io.KeyPress{449, true},
	io.KeyPress{450, true},
	io.KeyPress{451, true},
	io.KeyPress{452, true},
	io.KeyPress{453, true},
	io.KeyPress{454, true},
	io.KeyPress{455, true},
	io.KeyPress{456, true},
	io.KeyPress{457, true},
	io.KeyPress{458, true},
	io.KeyPress{459, true},
	io.KeyPress{460, true},
	io.KeyPress{461, true},
	io.KeyPress{462, true},
	io.KeyPress{463, true},
	io.KeyPress{464, true},
	io.KeyPress{465, true},
	io.KeyPress{466, true},
	io.KeyPress{467, true},
	io.KeyPress{468, true},
	io.KeyPress{469, true},
	io.KeyPress{470, true},
	io.KeyPress{471, true},
	io.KeyPress{472, true},
	io.KeyPress{473, true},
	io.KeyPress{474, true},
	io.KeyPress{475, true},
	io.KeyPress{476, true},
	io.KeyPress{477, true},
	io.KeyPress{478, true},
	io.KeyPress{479, true},
	io.KeyPress{480, true},
	io.KeyPress{481, true},
	io.KeyPress{482, true},
	io.KeyPress{483, true},
	io.KeyPress{484, true},
	io.KeyPress{485, true},
	io.KeyPress{486, true},
	io.KeyPress{487, true},
	io.KeyPress{488, true},
	io.KeyPress{489, true},
	io.KeyPress{490, true},
	io.KeyPress{491, true},
	io.KeyPress{492, true},
	io.KeyPress{493, true},
	io.KeyPress{494, true},
	io.KeyPress{495, true},
	io.KeyPress{496, true},
	io.KeyPress{497, true},
	io.KeyPress{498, true},
	io.KeyPress{499, true},
	io.KeyPress{500, true},
	io.KeyPress{501, true},
	io.KeyPress{502, true},
	io.KeyPress{503, true},
	io.KeyPress{504, true},
	io.KeyPress{505, true},
	io.KeyPress{506, true},
	io.KeyPress{507, true},
	io.KeyPress{508, true},
	io.KeyPress{509, true},
	io.KeyPress{510, true},
	io.KeyPress{511, true},
	io.KeyPress{512, true},
	io.KeyPress{513, true},
	io.KeyPress{514, true},
	io.KeyPress{515, true},
	io.KeyPress{516, true},
	io.KeyPress{517, true},
	io.KeyPress{518, true},
	io.KeyPress{519, true},
	io.KeyPress{520, true},
	io.KeyPress{521, true},
	io.KeyPress{522, true},
	io.KeyPress{523, true},
	io.KeyPress{524, true},
	io.KeyPress{525, true},
	io.KeyPress{526, true},
	io.KeyPress{527, true},
	io.KeyPress{528, true},
	io.KeyPress{529, true},
	io.KeyPress{530, true},
	io.KeyPress{531, true},
	io.KeyPress{532, true},
	io.KeyPress{533, true},
	io.KeyPress{534, true},
	io.KeyPress{535, true},
	io.KeyPress{536, true},
	io.KeyPress{537, true},
	io.KeyPress{538, true},
	io.KeyPress{539, true},
	io.KeyPress{540, true},
	io.KeyPress{541, true},
	io.KeyPress{542, true},
	io.KeyPress{543, true},
	io.KeyPress{544, true},
	io.KeyPress{545, true},
	io.KeyPress{546, true},
	io.KeyPress{547, true},
	io.KeyPress{548, true},
	io.KeyPress{549, true},
	io.KeyPress{550, true},
	io.KeyPress{551, true},
	io.KeyPress{552, true},
	io.KeyPress{553, true},
	io.KeyPress{554, true},
	io.KeyPress{555, true},
	io.KeyPress{556, true},
	io.KeyPress{557, true},
	io.KeyPress{558, true},
	io.KeyPress{559, true},
	io.KeyPress{560, true},
	io.KeyPress{561, true},
	io.KeyPress{562, true},
	io.KeyPress{563, true},
	io.KeyPress{564, true},
	io.KeyPress{565, true},
	io.KeyPress{566, true},
	io.KeyPress{567, true},
	io.KeyPress{568, true},
	io.KeyPress{569, true},
	io.KeyPress{570, true},
	io.KeyPress{571, true},
	io.KeyPress{572, true},
	io.KeyPress{573, true},
	io.KeyPress{574, true},
	io.KeyPress{575, true},
	io.KeyPress{576, true},
	io.KeyPress{577, true},
	io.KeyPress{578, true},
	io.KeyPress{579, true},
	io.KeyPress{580, true},
	io.KeyPress{581, true},
	io.KeyPress{582, true},
	io.KeyPress{583, true},
	io.KeyPress{584, true},
	io.KeyPress{585, true},
	io.KeyPress{586, true},
	io.KeyPress{587, true},
	io.KeyPress{588, true},
	io.KeyPress{589, true},
	io.KeyPress{590, true},
	io.KeyPress{591, true},
	io.KeyPress{592, true},
	io.KeyPress{593, true},
	io.KeyPress{594, true},
	io.KeyPress{595, true},
	io.KeyPress{596, true},
	io.KeyPress{597, true},
	io.KeyPress{598, true},
	io.KeyPress{599, true},
	io.KeyPress{600, true},
	io.KeyPress{601, true},
	io.KeyPress{602, true},
	io.KeyPress{603, true},
	io.KeyPress{604, true},
	io.KeyPress{605, true},
	io.KeyPress{606, true},
	io.KeyPress{607, true},
	io.KeyPress{608, true},
	io.KeyPress{609, true},
	io.KeyPress{610, true},
	io.KeyPress{611, true},
	io.KeyPress{612, true},
	io.KeyPress{613, true},
	io.KeyPress{614, true},
	io.KeyPress{615, true},
	io.KeyPress{616, true},
	io.KeyPress{617, true},
	io.KeyPress{618, true},
	io.KeyPress{619, true},
	io.KeyPress{620, true},
	io.KeyPress{621, true},
	io.KeyPress{622, true},
	io.KeyPress{623, true},
	io.KeyPress{624, true},
	io.KeyPress{625, true},
	io.KeyPress{626, true},
	io.KeyPress{627, true},
	io.KeyPress{628, true},
	io.KeyPress{629, true},
	io.KeyPress{630, true},
	io.KeyPress{631, true},
	io.KeyPress{632, true},
	io.KeyPress{633, true},
	io.KeyPress{634, true},
	io.KeyPress{635, true},
	io.KeyPress{636, true},
	io.KeyPress{637, true},
	io.KeyPress{638, true},
	io.KeyPress{639, true},
	io.KeyPress{640, true},
	io.KeyPress{641, true},
	io.KeyPress{642, true},
	io.KeyPress{643, true},
	io.KeyPress{644, true},
	io.KeyPress{645, true},
	io.KeyPress{646, true},
	io.KeyPress{647, true},
	io.KeyPress{648, true},
	io.KeyPress{649, true},
	io.KeyPress{650, true},
	io.KeyPress{651, true},
	io.KeyPress{652, true},
	io.KeyPress{653, true},
	io.KeyPress{654, true},
	io.KeyPress{655, true},
	io.KeyPress{656, true},
	io.KeyPress{657, true},
	io.KeyPress{658, true},
	io.KeyPress{659, true},
	io.KeyPress{660, true},
	io.KeyPress{661, true},
	io.KeyPress{662, true},
	io.KeyPress{663, true},
	io.KeyPress{664, true},
	io.KeyPress{665, true},
	io.KeyPress{666, true},
	io.KeyPress{667, true},
	io.KeyPress{668, true},
	io.KeyPress{669, true},
	io.KeyPress{670, true},
	io.KeyPress{671, true},
	io.KeyPress{672, true},
	io.KeyPress{673, true},
	io.KeyPress{674, true},
	io.KeyPress{675, true},
	io.KeyPress{676, true},
	io.KeyPress{677, true},
	io.KeyPress{678, true},
	io.KeyPress{679, true},
	io.KeyPress{680, true},
	io.KeyPress{681, true},
	io.KeyPress{682, true},
	io.KeyPress{683, true},
	io.KeyPress{684, true},
	io.KeyPress{685, true},
	io.KeyPress{686, true},
	io.KeyPress{687, true},
	io.KeyPress{688, true},
	io.KeyPress{689, true},
	io.KeyPress{690, true},
	io.KeyPress{691, true},
	io.KeyPress{692, true},
	io.KeyPress{693, true},
	io.KeyPress{694, true},
	io.KeyPress{695, true},
	io.KeyPress{696, true},
	io.KeyPress{697, true},
	io.KeyPress{698, true},
	io.KeyPress{699, true},
	io.KeyPress{700, true},
	io.KeyPress{701, true},
	io.KeyPress{702, true},
	io.KeyPress{703, true},
	io.KeyPress{704, true},
	io.KeyPress{705, true},
	io.KeyPress{706, true},
	io.KeyPress{707, true},
	io.KeyPress{708, true},
	io.KeyPress{709, true},
	io.KeyPress{710, true},
	io.KeyPress{711, true},
	io.KeyPress{712, true},
	io.KeyPress{713, true},
	io.KeyPress{714, true},
	io.KeyPress{715, true},
	io.KeyPress{716, true},
	io.KeyPress{717, true},
	io.KeyPress{718, true},
	io.KeyPress{719, true},
	io.KeyPress{720, true},
	io.KeyPress{721, true},
	io.KeyPress{722, true},
	io.KeyPress{723, true},
	io.KeyPress{724, true},
	io.KeyPress{725, true},
	io.KeyPress{726, true},
	io.KeyPress{727, true},
	io.KeyPress{728, true},
	io.KeyPress{729, true},
	io.KeyPress{730, true},
	io.KeyPress{731, true},
	io.KeyPress{732, true},
	io.KeyPress{733, true},
	io.KeyPress{734, true},
	io.KeyPress{735, true},
	io.KeyPress{736, true},
	io.KeyPress{737, true},
	io.KeyPress{738, true},
	io.KeyPress{739, true},
	io.KeyPress{740, true},
	io.KeyPress{741, true},
	io.KeyPress{742, true},
	io.KeyPress{743, true},
	io.KeyPress{744, true},
	io.KeyPress{745, true},
	io.KeyPress{746, true},
	io.KeyPress{747, true},
	io.KeyPress{748, true},
	io.KeyPress{749, true},
	io.KeyPress{750, true},
	io.KeyPress{751, true},
	io.KeyPress{752, true},
	io.KeyPress{753, true},
	io.KeyPress{754, true},
	io.KeyPress{755, true},
	io.KeyPress{756, true},
	io.KeyPress{757, true},
	io.KeyPress{758, true},
	io.KeyPress{759, true},
	io.KeyPress{760, true},
	io.KeyPress{761, true},
	io.KeyPress{762, true},
	io.KeyPress{763, true},
	io.KeyPress{764, true},
	io.KeyPress{765, true},
	io.KeyPress{766, true},
	io.KeyPress{767, true},
	io.KeyPress{768, true},
	io.KeyPress{769, true},
	io.KeyPress{770, true},
	io.KeyPress{771, true},
	io.KeyPress{772, true},
	io.KeyPress{773, true},
	io.KeyPress{774, true},
	io.KeyPress{775, true},
	io.KeyPress{776, true},
	io.KeyPress{777, true},
	io.KeyPress{778, true},
	io.KeyPress{779, true},
	io.KeyPress{780, true},
	io.KeyPress{781, true},
	io.KeyPress{782, true},
	io.KeyPress{783, true},
	io.KeyPress{784, true},
	io.KeyPress{785, true},
	io.KeyPress{786, true},
	io.KeyPress{787, true},
	io.KeyPress{788, true},
	io.KeyPress{789, true},
	io.KeyPress{790, true},
	io.KeyPress{791, true},
	io.KeyPress{792, true},
	io.KeyPress{793, true},
	io.KeyPress{794, true},
	io.KeyPress{795, true},
	io.KeyPress{796, true},
	io.KeyPress{797, true},
	io.KeyPress{798, true},
	io.KeyPress{799, true},
	io.KeyPress{800, true},
	io.KeyPress{801, true},
	io.KeyPress{802, true},
	io.KeyPress{803, true},
	io.KeyPress{804, true},
	io.KeyPress{805, true},
	io.KeyPress{806, true},
	io.KeyPress{807, true},
	io.KeyPress{808, true},
	io.KeyPress{809, true},
	io.KeyPress{810, true},
	io.KeyPress{811, true},
	io.KeyPress{812, true},
	io.KeyPress{813, true},
	io.KeyPress{814, true},
	io.KeyPress{815, true},
	io.KeyPress{816, true},
	io.KeyPress{817, true},
	io.KeyPress{818, true},
	io.KeyPress{819, true},
	io.KeyPress{820, true},
	io.KeyPress{821, true},
	io.KeyPress{822, true},
	io.KeyPress{823, true},
	io.KeyPress{824, true},
	io.KeyPress{825, true},
	io.KeyPress{826, true},
	io.KeyPress{827, true},
	io.KeyPress{828, true},
	io.KeyPress{829, true},
	io.KeyPress{830, true},
	io.KeyPress{831, true},
	io.KeyPress{832, true},
	io.KeyPress{833, true},
	io.KeyPress{834, true},
	io.KeyPress{835, true},
	io.KeyPress{836, true},
	io.KeyPress{837, true},
	io.KeyPress{838, true},
	io.KeyPress{839, true},
	io.KeyPress{840, true},
	io.KeyPress{841, true},
	io.KeyPress{842, true},
	io.KeyPress{843, true},
	io.KeyPress{844, true},
	io.KeyPress{845, true},
	io.KeyPress{846, true},
	io.KeyPress{847, true},
	io.KeyPress{848, true},
	io.KeyPress{849, true},
	io.KeyPress{850, true},
	io.KeyPress{851, true},
	io.KeyPress{852, true},
	io.KeyPress{853, true},
	io.KeyPress{854, true},
	io.KeyPress{855, true},
	io.KeyPress{856, true},
	io.KeyPress{857, true},
	io.KeyPress{858, true},
	io.KeyPress{859, true},
	io.KeyPress{860, true},
	io.KeyPress{861, true},
	io.KeyPress{862, true},
	io.KeyPress{863, true},
	io.KeyPress{864, true},
	io.KeyPress{865, true},
	io.KeyPress{866, true},
	io.KeyPress{867, true},
	io.KeyPress{868, true},
	io.KeyPress{869, true},
	io.KeyPress{870, true},
	io.KeyPress{871, true},
	io.KeyPress{872, true},
	io.KeyPress{873, true},
	io.KeyPress{874, true},
	io.KeyPress{875, true},
	io.KeyPress{876, true},
	io.KeyPress{877, true},
	io.KeyPress{878, true},
	io.KeyPress{879, true},
	io.KeyPress{880, true},
	io.KeyPress{881, true},
	io.KeyPress{882, true},
	io.KeyPress{883, true},
	io.KeyPress{884, true},
	io.KeyPress{885, true},
	io.KeyPress{886, true},
	io.KeyPress{887, true},
	io.KeyPress{888, true},
	io.KeyPress{889, true},
	io.KeyPress{890, true},
	io.KeyPress{891, true},
	io.KeyPress{892, true},
	io.KeyPress{893, true},
	io.KeyPress{894, true},
	io.KeyPress{895, true},
	io.KeyPress{896, true},
	io.KeyPress{897, true},
	io.KeyPress{898, true},
	io.KeyPress{899, true},
	io.KeyPress{900, true},
	io.KeyPress{901, true},
	io.KeyPress{902, true},
	io.KeyPress{903, true},
	io.KeyPress{904, true},
	io.KeyPress{905, true},
	io.KeyPress{906, true},
	io.KeyPress{907, true},
	io.KeyPress{908, true},
	io.KeyPress{909, true},
	io.KeyPress{910, true},
	io.KeyPress{911, true},
	io.KeyPress{912, true},
	io.KeyPress{913, true},
	io.KeyPress{914, true},
	io.KeyPress{915, true},
	io.KeyPress{916, true},
	io.KeyPress{917, true},
	io.KeyPress{918, true},
	io.KeyPress{919, true},
	io.KeyPress{920, true},
	io.KeyPress{921, true},
	io.KeyPress{922, true},
	io.KeyPress{923, true},
	io.KeyPress{924, true},
	io.KeyPress{925, true},
	io.KeyPress{926, true},
	io.KeyPress{927, true},
	io.KeyPress{928, true},
	io.KeyPress{929, true},
	io.KeyPress{930, true},
	io.KeyPress{931, true},
	io.KeyPress{932, true},
	io.KeyPress{933, true},
	io.KeyPress{934, true},
	io.KeyPress{935, true},
	io.KeyPress{936, true},
	io.KeyPress{937, true},
	io.KeyPress{938, true},
	io.KeyPress{939, true},
	io.KeyPress{940, true},
	io.KeyPress{941, true},
	io.KeyPress{942, true},
	io.KeyPress{943, true},
	io.KeyPress{944, true},
	io.KeyPress{945, true},
	io.KeyPress{946, true},
	io.KeyPress{947, true},
	io.KeyPress{948, true},
	io.KeyPress{949, true},
	io.KeyPress{950, true},
	io.KeyPress{951, true},
	io.KeyPress{952, true},
	io.KeyPress{953, true},
	io.KeyPress{954, true},
	io.KeyPress{955, true},
	io.KeyPress{956, true},
	io.KeyPress{957, true},
	io.KeyPress{958, true},
	io.KeyPress{959, true},
	io.KeyPress{960, true},
	io.KeyPress{961, true},
	io.KeyPress{962, true},
	io.KeyPress{963, true},
	io.KeyPress{964, true},
	io.KeyPress{965, true},
	io.KeyPress{966, true},
	io.KeyPress{967, true},
	io.KeyPress{968, true},
	io.KeyPress{969, true},
	io.KeyPress{970, true},
	io.KeyPress{971, true},
	io.KeyPress{972, true},
	io.KeyPress{973, true},
	io.KeyPress{974, true},
	io.KeyPress{975, true},
	io.KeyPress{976, true},
	io.KeyPress{977, true},
	io.KeyPress{978, true},
	io.KeyPress{979, true},
	io.KeyPress{980, true},
	io.KeyPress{981, true},
	io.KeyPress{982, true},
	io.KeyPress{983, true},
	io.KeyPress{984, true},
	io.KeyPress{985, true},
	io.KeyPress{986, true},
	io.KeyPress{987, true},
	io.KeyPress{988, true},
	io.KeyPress{989, true},
	io.KeyPress{990, true},
	io.KeyPress{991, true},
	io.KeyPress{992, true},
	io.KeyPress{993, true},
	io.KeyPress{994, true},
	io.KeyPress{995, true},
	io.KeyPress{996, true},
	io.KeyPress{997, true},
	io.KeyPress{998, true},
	io.KeyPress{999, true},
	io.KeyPress{1000, true},
	io.KeyPress{1001, true},
	io.KeyPress{1002, true},
	io.KeyPress{1003, true},
	io.KeyPress{1004, true},
	io.KeyPress{1005, true},
	io.KeyPress{1006, true},
	io.KeyPress{1007, true},
	io.KeyPress{1008, true},
	io.KeyPress{1009, true},
	io.KeyPress{1010, true},
	io.KeyPress{1011, true},
	io.KeyPress{1012, true},
	io.KeyPress{1013, true},
	io.KeyPress{1014, true},
	io.KeyPress{1015, true},
	io.KeyPress{1016, true},
	io.KeyPress{1017, true},
	io.KeyPress{1018, true},
	io.KeyPress{1019, true},
	io.KeyPress{1020, true},
	io.KeyPress{1021, true},
	io.KeyPress{1022, true},
	io.KeyPress{1023, true},
}
